$(function(){
	showMessage();
});	
//教练加载信息
function showMessage(){
	$.ajax({
		url:"/vi_user_gym/selectByUid",
		type:"post",
		success:function(data){
			// 改变头像图片源
			if (data.headImage == ""||data.headImage==null) {
				//设置默认头像图片
				$("#my-img").attr("src", "/images/滑稽.png");
				}
			else{
			$("#my-img").attr("src", "/images/" + data.headImage);
			}
			if(data.nickName==null ||data.nickName==""){
				data.nickName="未知";
			}
			if(data.gname==null||data.gname==""){
				data.gname="未知"
			}
			if(data.ggrade==null || data.ggrade==""){
				data.ggrade="未知"
			}
			if(data.gintroduction==null || data.gintroduction==""){
				
				data.gintroduction="未知"
			}
			
			if(data.address==null || data.address==""){
				data.address="未知"
			}
			
			// 通过改变 text的value值来显示的信息
			var content ='<div class="layui-form-item" style="font-size: 20px; text-align: center" >基本信息</div>';
			var nickName ='<label class="layui-form-label" ">昵称</label>'
				+'<div class="layui-input-inline">'
			    +'<input type="text" name="nickName"  required lay-verify="required" value="'+data.nickName+'" disabled="disabled" autocomplete="off" class="layui-input">'		
				+'</div>'
			var gname ='<label class="layui-form-label" >场馆名称</label>'
				+'<div class="layui-input-inline">'
			    +' <input type="text" name="gname" value="'+data.gname+'" disabled="disabled" required lay-verify="required"  autocomplete="off" class="layui-input">'		
				+'</div>';
			var ggrade='<div class="layui-form-item" >'
				    +'  <label class="layui-form-label">评分</label>'
					+'<div class="layui-input-inline">'
				    +' <input type="text" name="ggrade" value="'+data.ggrade+'" disabled="disabled" required lay-verify="required"  autocomplete="off" class="layui-input">'		
					+'</div></div>'
			
			var address='<div class="layui-form-item" >'
			   +' <label class="layui-form-label">地址</label>'
			   +'<div class="layui-input-inline">'
				+'<input type="text" id="add" name="address" value="'+data.address+'" disabled="disabled" required lay-verify="required"  autocomplete="off" class="layui-input">'	
			  +'</div></div> '
			var gintroduction ='<div class="layui-form-item ">'
			    +'<label class="layui-form-label">场馆介绍</label>'
			    +'<div class="layui-input-inline" style="width: 70%;">'
			     +' <textarea name="gintroduction"  disabled="disabled" class="layui-textarea">'+data.gintroduction+'</textarea>'
			   +' </div></div>'		
			var botton='<div class="layui-form-item">'
			    +'<div class="layui-input-block">'
			     /*+'<button class="layui-btn" id="send">编辑</button>'*/
			    +'<input type="button" class="layui-btn" onclick="set()" value="编辑">'
			    +'</div></div>'				
						
			content+=
			'<div class="layui-form-item">'+nickName+gname+'</div>'
			+'<div class="layui-form-item">'+address+ggrade+'</div>'
			+'<div class="layui-form-item">'+gintroduction+'</div>'
			+botton
			
			$("#updateMessage").html(content)			
		}	
	});
}

function set(){
	location.href="/html/gymCompile.html";
}

